Skip to content

Conversation

@cnweaver
Copy link
Collaborator

Allow mixing results across multiple topics, with potentially differing access levels.
Allow reversing the order of results.
Use more efficient paging.

This is the first phase of updates to support a better REST API/Web UI, which includes all changes that could be made without changes to the data stored in the database.

Allow mixing results across multiple topics, with potentially differing access levels.
Allow reversing the order of results.
Use more efficient paging.
@cnweaver cnweaver self-assigned this Dec 19, 2025
@cnweaver cnweaver added the enhancement New feature or request label Dec 19, 2025
Copy link

@jnation3406 jnation3406 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks okay to me. One thing I have noticed is that if you have a topic filter (one or more), then while the initial query is fairly fast (1-2s), each subsequent page load with pagination takes much longer (10-12s). This same slowdown for pagination doesn't seem to appear when no topic filters are present.

if offset > 0:
offset -= 1
topics = set()
for record in self.data.values():

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like your deleted comment above suggests, this is very inneficient right? Maybe it would be better to cache public topics (and update cached topics on new message ingestion)?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh is this just a test fixture - then ignore my comment i guess

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, this code path should only be used by tests.

else:
full_clause = None
if pub_clause is not None and full_clause is not None:
q = q.where(sqlalchemy.or_(pub_clause, full_clause))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this equally as efficient as combining the topics into one big list and doing a single where topic in clause?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not as efficient, but is required for correctness because the 'public' clause includes different restrictions (topic is one of the public topics, and the message is public). We must not lose that restriction on things with 'public' access level, and don't want to enforce it on things with 'full' access level.

@cnweaver
Copy link
Collaborator Author

One thing I have noticed is that if you have a topic filter (one or more), then while the initial query is fairly fast (1-2s), each subsequent page load with pagination takes much longer (10-12s). This same slowdown for pagination doesn't seem to appear when no topic filters are present.

That is not supposed to happen, and I don't think I've seen anything like it in my testing. I'll try to check it again, but do you have any representative API requests for which this occurs?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants